import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './vuex/store'
import './registerServiceWorker'
//引入二次封装
import "@/utils/axios"


//初始化所有的基础样式
import "reset-css"
//导入element-ui
import Elementui from "element-ui"
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(Elementui);
Vue.config.productionTip = false
import "./apis/assets/css/font-awesome.css"
import apis from "@/apis"
import "@/mixins/mixins"
//全局api
Vue.prototype.$api=apis;

router.beforeEach((to,from,next)=>{
	if(to.path==="/Signin"){
		localStorage.clear();
		next();
	}else{
		if(localStorage.getItem("token")){
			next();
		}else{
			next({path:"/Signin",query:{redirect:to.path}});
		}
	}
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')